#include <stdio.h>
#include <string.h>

#define MAX_BUF 10000

int rabin_karp(char* s, char* p, int d, int q);

int main()
{
	char s[MAX_BUF] = {0}, p[MAX_BUF] = {0};
	int pos = 0;
	scanf("%[^\n]", s);
	getchar();
	scanf("%[^\n]", p);
	pos = rabin_karp(s, p, 157, 10000000);
	if (pos == -1) printf("Not found\n");
	else printf("%d\n", pos);
	return 0;
}

int rabin_karp(char* s, char* p, int d, int q)
{
	int n = strlen(s), m = strlen(p);
	unsigned int h = 1;
	unsigned int ph = 0, sh = 0;
	int i = 0, j = 0;
	if (m > n) return -1;
	for (i = 0; i < m-1; i++) h = (h * d) % q;
	for (i = 0; i < m; i++) 
	{
		ph = (d*ph + p[i]) % q;
		sh = (d*sh + s[i]) % q;
	}
	for (i = 0; i <= n - m; i++)
	{
		if (ph == sh)
		{
			int b = 1;
			for (j = 0; j < m; j++)
				if (s[i+j] != p[j])
				{
					b = 0;
					break;
				}
			if (b) return i;
		}
		if (i != n-m) 
			sh = (((sh+q-(s[i]*h % q))*d) + s[i+m]) % q;
	}
	return -1;	
}
